<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>game1</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<!--标准mui.css-->
		<link rel="stylesheet" href="../css/mui.min.css">
		<link rel="stylesheet" href="../css/game1.css">
		<style>
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">幸运大转盘</h1>
		</header>
		<img src="../images/game1/gamebg1.gif" alt="" class="bgimg">
		<p id="jilu"><a href="#"><img src="../images/game1/dajiang.png"/></a></p>  
		<div id="inner">  
	       <img id="xuanzhuanimg" src="../images/game1/xuanzhuan.png">   
	    </div>	
		<div class="contentbox">
			<p id="yue"></p>
			<p id="shijian"></p> 
			<p id="chongzhi"><a href="#"><img src="../images/game1/dajiang.png"/></a></p>    
			<div class="mui-numbox" data-numbox-step='100' data-numbox-min='100' data-numbox-max='900'>
					<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
					<input class="mui-input-numbox" type="number" />
					<button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
			</div>
			
		    <p id="xianshi"></p>
		    <div id="xiazhu">
		    	<div><img src="../images/game1/100.png"/><span>投注</span></div>
		    	<div><img src="../images/game1/10.png"/><span>投注</span></div>
		    	<div><img src="../images/game1/6.png"/><span>投注</span></div>
		    	<div class="top15"><img src="../images/game1/5.png"/><span>投注</span></div>
		    	<div class="top15"><img src="../images/game1/4.png"/><span>投注</span></div>
		    	<div class="top15"><img src="../images/game1/2.png"/><span>投注</span></div>
		    </div>
		    <div class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
		    <div class="mui-scroll">
		    	<ul class="scrollbox">
				  <li class="mui-control-item"><a href="#"><img src="../images/goods12.jpg" alt="">  </a></li>
		          <li class="mui-control-item"><a href="#"><img src="../images/goods13.jpg" alt=""> </a></li>
		          <li class="mui-control-item"><a href="#"><img src="../images/goods14.jpg" alt=""> </a></li>
		          <li class="mui-control-item"><a href="#"><img src="../images/goods15.jpg" alt=""> </a></li>
		          <li class="mui-control-item"><a href="#"><img src="../images/goods16.jpg" alt=""> </a></li>
		    	</ul>
		    </div>
		 </div>
        </div>
		<script src="../js/mui.min.js"></script>
		<script src="../js/jquery.min.js"></script>
		<script type="text/javascript" src="../js/jQueryRotate.js"></script> 
		<script type="text/javascript" src="../js/jquery.cookie.js"></script> 
		<script>
	var name;
	var balance;
	var time;  
	var prize="";   
	
	if(!balance){
		$("#yue").html(""+(balance-$("select").val())+"");
	}
	$("#xiazhu div").click(function(){
		$(this).find("span").html("已投注");
		$(this).siblings().find("span").html("投注");
	})
    $(function() {         
    	var time;       
        $.ajax({  
            type : 'POST',  
            url : 'http://192.168.1.113:8080/weixin/getDaoJiShi.do?username=q',   
            dataType : 'json',   
            cache : false,  
            error : function() {  
      
                return false;  
            },    
            success : function(json) {  
            	console.log(json.balance)
            	$("#yue").html(""+json.balance);
                time=json.time;
                console.log(json.time)
                balance=json.balance;
            }  
        });
        setInterval(function(){
        	if(time>1){
        		time--;
        	}else{
        		time=10;
        	}
        	if(time==1){
        		lottery();
        	}
    		$("#shijian").html(time);
    	},1000);
    }); 
    
    function lottery() {
    	var balance=$("select").val();
    	   $.ajax({ 
               type : 'POST',  
               url : 'http://192.168.1.113:8080/weixin/dazhuanpan.do?username=q&balance=10&prize="" ',  
               dataType : 'json',  
               cache : false,  
               error : function() {  
//                 
                   return false;  
               },    
               success : function(json) { 
            	   prize="";
            	   $("#yue").html(""+json.balance);
            	   $("#xianshi").html("");
                   var angle = parseInt(json.angle); //角度   
                   var msg = json.msg; //提示信息    
                   time=json.time;
   	                $("#xuanzhuanimg").rotate({ 
   	                    duration : 4000, //转动时间   
   	                    angle : 0, //开始角度   
   	                    animateTo : 3600 + angle, //转动角度   
   	                    callback : function() {  
   	                    	$("#xianshi").html('本次开奖\n'+msg);    	                       
   	                    }  
   	                });                 
               }  
           });
       
      }
    
//  $(document).on("change","select",function(){	
//		$("#xianshi").html("你已选择了"+prize+$("select").val()+"注");
//		});
     
    

//	$(document).on("click","#xiazhu div",function(){	
//		prize=$(this).html();
//		$("#xianshi").html("你已选择了"+$(this).html()+$("select").val()+"注");
//		});
//奖品拖拽

		</script>
	</body>

</html>